<?php
session_start();
$laiyuan='默认';
if (isset($_GET['hmsr'])){
	$_SESSION['laiyuan']=$_GET['hmsr'];
}
if (isset($_SESSION['laiyuan'])){
	$laiyuan=$_SESSION['laiyuan'];
}
$url='./img/';
include './c/config.php';
include_once 'jssdk.php';
$_SESSION['open']='not';
if (isset($_GET['open']) && !empty($_GET['open'])){
	$_SESSION['open']=$_GET['open'];
}
$open=$_SESSION['open'];

$user_agent = $_SERVER['HTTP_USER_AGENT'];
if (strpos($user_agent, 'MicroMessenger') === false) {
	header('Location: home.php?hmsr='.$laiyuan);
	exit;
}
if (isset($_SESSION['openid'])){
	$openid=$_SESSION['openid'];
	header('Location: home.php?hmsr='.$laiyuan);
	exit;
	/**
	$mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
	if (!$mysqli->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqliTwo->error);}
	$query=$mysqli->query("SELECT name FROM `users` where openid='".$openid."' limit 0,1 ");
	if($query->num_rows>0){
		$userInfo=$query->fetch_array();
		$userName=base64_decode($userInfo['name']);
		
	}
	*/
}else{
	$url='http://carrier.omnimkt.com/iaqcampaign/minisite/api/?c=start&open='.$open;
	header('Location: '.$url);
	exit;
}